{% load inventree_extras %}
{% load i18n %}

<tr>
    <td>
        {% if plugin.is_active %}
        <span class='fas fa-check-circle icon-green'></span>
        {% else %}
        <span class='fas fa-times-circle icon-red'></span>
        {% endif %}

        {% if plugin.human_name %}
        {{ plugin.human_name }}
        {% elif plugin.title %}
        {{ plugin.title }}
        {% elif plugin.name %}
        {{ plugin.name }}
        {% endif %}

        {% define plugin.registered_mixins as mixin_list %}

        {% if mixin_list %}
        {% for mixin in mixin_list %}
        <a class='sidebar-selector' id='select-plugin-{{plugin_key}}' data-bs-parent="#sidebar">
            <span class='badge bg-dark badge-right rounded-pill'>{{ mixin.human_name }}</span>
        </a>
        {% endfor %}
        {% endif %}

        {% if plugin.is_builtin %}
        <a class='sidebar-selector' id='select-plugin-{{ plugin_key }}' data-bs-parent='#sidebar'>
            <span class='badge bg-success rounded-pill badge-right'>{% trans "Builtin" %}</span>
        </a>
        {% endif %}

        {% if plugin.is_sample %}
        <a class='sidebar-selector' id='select-plugin-{{plugin_key}}' data-bs-parent="#sidebar">
            <span class='badge bg-info rounded-pill badge-right'>{% trans "Sample" %}</span>
        </a>
        {% endif %}

        {% if plugin.website %}
        <a href="{{ plugin.website }}"><span class="fas fa-globe"></span></a>
        {% endif %}
    </td>
    <td>{{ plugin_key }}</td>
    {% trans "Unvailable" as no_info %}
    <td>
        {% if plugin.author %}
        {{ plugin.author }}
        {% else %}
        <em>{{ no_info }}</em>
        {% endif %}
    </td>
    <td>
        {% if plugin.pub_date %}
        {% render_date plugin.pub_date %}
        {% else %}
        <em>{{ no_info }}</em>
        {% endif %}
    </td>
    <td>
        {% if plugin.version %}
        {{ plugin.version }}
        {% else %}
        <em>{{ no_info }}</em>
        {% endif %}
    </td>
    <td>
        {% if user.is_staff and perms.plugin.change_pluginconfig %}
        {% url 'admin:plugin_pluginconfig_change' plugin.pk as url %}
        {% include "admin_button.html" with url=url %}
        {% endif %}
    </td>
</tr>
